package cn.edu.scau.cmi.chenmiaopeng.hibernate.domain;
import java.util.Set;

import cn.edu.scau.cmi.chenmiaopeng.hibernate.domain.Student;

import java.util.HashSet;
public class Teacher {
  private long id;
  private String name;
  private Set<Student> instruct_stus= new HashSet(0);
  /*default constructor*/
  public Teacher() {
	  
  }
  public Teacher(long id) {
	  this.id = id;
  }
  public Teacher(long id,String name) {
	  this.id = id;
	  this.name = name;
  }
  public void setId(long id) {
	  this.id = id;
  }
  public void setName(String name) {
	  this.name = name;
  }
  public void setStudents(Set<Student> instr_stus) {
	  this.instruct_stus = instr_stus;
  }
  
  public long getId() {
	  return id;
  }
  public String getName() {
	  return name;
  }
  public Set<Student> getStudents(){  //不能用 getInstructStus
	  return instruct_stus;
  }
  public String toString() {
	  return "工号:"+this.id+" 老师名:"+this.name;
  }
  public int hashCode() {
	  return 0;
  }
  public boolean equals(Object otherT) {
	  if(otherT==null) {
		  return false;
	  }
	  else if(!(otherT instanceof Teacher)) {
		  return false;
	  }
	  else {
		  Teacher otherTeacher = (Teacher)otherT;
		  if(getId()==otherTeacher.getId()&&getName().equals(otherTeacher.getName())) {
			  return true;
		  }
		  else return false;
	  }
  }
}
